from selenium.webdriver.common.by import By

from utils.page_base import PageBase #导入页面基类

class PageUI2(PageBase):
    url="/simple/login"
    loc_zanhao=By.NAME,"login_info"
    loc_pwd=By.NAME,"password"
    loc_login=By.CSS_SELECTOR,"input[value='登录']"
    loc_errorTip=By.CSS_SELECTOR,"div.prompt"


    def __init__(self, driver, base_url):
        PageBase.__init__(self, driver, base_url)

    #输入账号
    def inputZanhao(self,zanhao):
        self.input(PageUI2.loc_zanhao,zanhao)

    #输入密码
    def inputPwd(self,pwd):
        self.input(PageUI2.loc_pwd,pwd)

    #点击登录按钮
    def clickLogin(self):
        self.click(PageUI2.loc_login)

    #获取错误提示div的文本内容：账号或密码错误
    def getErrorTip(self):
        return self.getText(PageUI2.loc_errorTip)

    #获取密码框的class属性的值
    def getPwdClass(self):
        return self.getAttr(PageUI2.loc_pwd,"class")


